<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			//字面量
			var name = "张三";
			//构造函数
			var p = new String("李四");

			//----------------查-------------------------------------------
			var str = "abcdefghijklmn";
			var index = str.indexOf("b");
			// console.log(index);

			//----------------截取------------------------------------------
			var sub = str.substring(3, 5); //de  包含开始，不包含结束
			// console.log(sub); //defghijklmn


			/*
			   "dkfjhfhhoihfoiefhowifhsdlhsdalfhsdfhsdlkf"
			   统计f出现的次数
			*/

			var str2 = "dkfjhfhhoihfoiefhowifhsdlhsdalfhsdfhsdlkf";

			var i = -2;
			var count = 0;
			// i = str2.indexOf("f")

			/* while (i = str2.indexOf("f") != -1) {
				count++;
				str2 = str2.substring(i + 1);
			} */

			i = str2.indexOf("f",0 );
			
			i = str2.indexOf("f", i+1)
			
			i = str2.indexOf("f", i+1);

			console.log("f出现的次数:" + count);

			/* var i = str2.indexOf("f");
			str2 = str2.substring(i + 1);
			
			i = str2.indexOf("f");
			str2 = str2.substring(i + 1);
			
			i = str2.indexOf("f");
			str2 = str2.substring(i + 1);
			
			i = str2.indexOf("f");
			str2 = str2.substring(i + 1); */
		</script>
	</head>
</html>
